/**
 * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see https://ckeditor.com/legal/ckeditor-oss-license
 */

CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here.
	// For complete reference see:
	// https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html

	// The toolbar groups arrangement, optimized for two toolbar rows.
	config.toolbarGroups = [
		{ name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
		{ name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] },
		{ name: 'links', groups: [ 'links' ] },
		{ name: 'insert', groups: [ 'insert' ] },
		{ name: 'forms', groups: [ 'forms' ] },
		{ name: 'others', groups: [ 'others' ] },
		{ name: 'styles', groups: [ 'styles' ] },
		'/',
		{ name: 'colors', groups: [ 'colors' ] },
		{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
		{ name: 'paragraph', groups: [ 'list', 'blocks', 'align', 'indent', 'bidi', 'paragraph' ] },
		{ name: 'tools', groups: [ 'tools' ] },
		{ name: 'document', groups: [ 'mode', 'document', 'doctools' ] },
		{ name: 'about', groups: [ 'about' ] }
	];

	// Remove some buttons provided by the standard plugins, which are
	// not needed in the Standard(s) toolbar.
	//config.removeButtons = 'Underline,Subscript,Superscript';

	// Set the most common block elements.
	config.format_tags = 'p;h1;h2;h3;h4;pre';

	// Simplify the dialog windows.
	config.removeDialogTabs = 'image:advanced;link:advanced';

	// ckfinder 配置
	config.filebrowserBrowseUrl = '/static/ckfinder/ckfinder.html';
	config.filebrowserUploadUrl = '/admin/ckfinder?command=QuickUpload&type=Files';
	config.filebrowserImageUploadUrl = '/admin/ckfinder?command=QuickUpload&type=Images';

	// highlightjs 颜色主题
	config.codeSnippet_theme = 'stackoverflow-dark';

	// highlightjs 语言支持
	config.codeSnippet_languages = {
		"properties": ".properties",
		"apache": "Apache config",
		"bash": "Bash",
		"c": "C",
		"csharp": "C#",
		"cpp": "C++",
		"css": "CSS",
		"coffeescript": "CoffeeScript",
		"diff": "Diff",
		"dockerfile": "Dockerfile",
		"go": "Go",
		"xml": "HTML, XML",
		"http": "HTTP",
		"json": "JSON",
		"java": "Java",
		"javascript": "JavaScript",
		"kotlin": "Kotlin",
		"less": "Less",
		"lua": "Lua",
		"makefile": "Makefile",
		"markdown": "Markdown",
		"nginx": "Nginx config",
		"objectivec": "Objective-C",
		"php": "PHP",
		"php-template": "PHP Template",
		"perl": "Perl",
		"plaintext": "Plain text",
		"python": "Python",
		"python-repl": "Python REPL",
		"r": "R",
		"ruby": "Ruby",
		"rust": "Rust",
		"scss": "SCSS",
		"sql": "SQL",
		"shell": "Shell Session",
		"swift": "Swift",
		"ini": "TOML, also INI",
		"typescript": "TypeScript",
		"vbnet": "Visual Basic .NET",
		"yaml": "YAML"
	};
};
